package org.example.demo;

import java.util.List;
import java.util.Map;
import java.util.ArrayList;
public class Demo01 {

    public static void demo(){
        List<String> list = new ArrayList<>(List.of("《水浒传》", "《三国演义》", "《西游记》", "《红楼梦》"));
        for (String l:list){
            if(l.equals("《金瓶梅》")){
                System.out.println(l);
                System.out.println("true");
            }
            else {
                System.out.println("false");
            }

        }
        list.add(2,"《西厢记》");
        System.out.println("将《西厢记》添加到《西游记》之后，书架上"+list);
        list.set(4,"《聊斋志异》");
        System.out.println("将《聊斋志异》替换为《红楼梦》后，书架上"+list);
        list.remove(0);
        list.remove(0);
        System.out.println("书架上："+list);
        list.add("《儒林外史》、《牡丹亭》、《离骚》");
        System.out.println(list);
    }
    public static void main(String[] args) {
        demo();
    }
}

